/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * BusquedaAlumno.java
 *
 * Created on 30/07/2011, 04:16:24 PM
 */
package bufete;

import callProcs.ProcsAlumno;
import callProcs.ProcsInsertar;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Victor
 */
public class BusquedaAlumno extends javax.swing.JFrame {

    /** Creates new form BusquedaAlumno */
   private int idDpto;
        ProcsInsertar alumno = new ProcsInsertar();
        ProcsAlumno est = new ProcsAlumno();
        String idDir;
        String telCasa, telCel;
        
     public BusquedaAlumno() {
        initComponents();
        
        int idDpto;

                try {
            java.sql.ResultSet rcarne = est.ObtieneCarne();
            while (rcarne.next())
            {
                cb_Carne.addItem(rcarne.getObject("NoCarne"));
            }
            java.sql.ResultSet rs= alumno.verDepartementos();
            while (rs.next()){
                cb_dpto.addItem(rs.getObject("Nombre_departamento"));
            }
        } catch (SQLException ex) {
           // Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        cb_Carne = new javax.swing.JComboBox();
        t_Nombres = new javax.swing.JTextField();
        t_Apellidos = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        cb_dpto = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        cb_muni = new javax.swing.JComboBox();
        t_Direccion = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        t_Zona = new javax.swing.JTextField();
        l_Bufete = new javax.swing.JLabel();
        Cedula_DPI = new javax.swing.JPanel();
        l_NoRegistro = new javax.swing.JLabel();
        t_Registro = new javax.swing.JTextField();
        cb_NoOrden = new javax.swing.JComboBox();
        l_NoOrden = new javax.swing.JLabel();
        l_Cedula_DPI = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        t_Correo = new javax.swing.JTextField();
        t_Cel = new javax.swing.JTextField();
        t_Casa = new javax.swing.JTextField();
        rb_Casado = new javax.swing.JRadioButton();
        rb_Soltero = new javax.swing.JRadioButton();
        l_EstadoCivil1 = new javax.swing.JLabel();
        l_Telefono = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel2.setName("jPanel2"); // NOI18N

        cb_Carne.setName("cb_Carne"); // NOI18N
        cb_Carne.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cb_CarneItemStateChanged(evt);
            }
        });

        t_Nombres.setName("t_Nombres"); // NOI18N

        t_Apellidos.setName("t_Apellidos"); // NOI18N

        jLabel4.setName("jLabel4"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bufete.BufeteApp.class).getContext().getResourceMap(BusquedaAlumno.class);
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(49, 49, 49)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel9))
                .addGap(51, 51, 51)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cb_Carne, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(t_Nombres, javax.swing.GroupLayout.PREFERRED_SIZE, 447, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(t_Apellidos, javax.swing.GroupLayout.PREFERRED_SIZE, 447, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(77, 77, 77)
                .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE)
                .addComponent(jLabel4)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
                .addGap(47, 47, 47))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(cb_Carne, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(t_Nombres, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(t_Apellidos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addContainerGap(25, Short.MAX_VALUE))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        cb_dpto.setName("cb_dpto"); // NOI18N
        cb_dpto.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cb_dptoItemStateChanged(evt);
            }
        });
        cb_dpto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cb_dptoActionPerformed(evt);
            }
        });

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        cb_muni.setName("cb_muni"); // NOI18N
        cb_muni.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cb_muniActionPerformed(evt);
            }
        });

        t_Direccion.setName("t_Direccion"); // NOI18N

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jLabel20.setText(resourceMap.getString("jLabel20.text")); // NOI18N
        jLabel20.setName("jLabel20"); // NOI18N

        t_Zona.setName("t_Zona"); // NOI18N
        t_Zona.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_ZonaKeyTyped(evt);
            }
        });

        l_Bufete.setName("l_Bufete"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(7, 7, 7))
                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(201, 201, 201)
                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(347, 347, 347)
                        .addComponent(l_Bufete, javax.swing.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE))
                    .addComponent(t_Zona, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(t_Direccion, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(cb_muni, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(cb_dpto, javax.swing.GroupLayout.Alignment.LEADING, 0, 499, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(l_Bufete, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cb_dpto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cb_muni, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(t_Direccion, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel15)
                    .addComponent(t_Zona, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33))
        );

        Cedula_DPI.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        Cedula_DPI.setName("Cedula_DPI"); // NOI18N

        l_NoRegistro.setText(resourceMap.getString("l_NoRegistro.text")); // NOI18N
        l_NoRegistro.setName("l_NoRegistro"); // NOI18N

        t_Registro.setName("t_Registro"); // NOI18N
        t_Registro.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_RegistroKeyTyped(evt);
            }
        });

        cb_NoOrden.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "A-01", "B-02", "C-03", "D-04", "E-05", "F-06", "G-07", "H-08", "I-09", "J-10", "K-11", "L-12", "M-13", "N-14", "O-15", "P-16", "Q-17", "R-18", "S-19", "T-20", "U-21", "V-22" }));
        cb_NoOrden.setName("cb_NoOrden"); // NOI18N
        cb_NoOrden.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cb_NoOrdenActionPerformed(evt);
            }
        });

        l_NoOrden.setText(resourceMap.getString("l_NoOrden.text")); // NOI18N
        l_NoOrden.setName("l_NoOrden"); // NOI18N

        l_Cedula_DPI.setFont(resourceMap.getFont("l_Cedula_DPI.font")); // NOI18N
        l_Cedula_DPI.setText(resourceMap.getString("l_Cedula_DPI.text")); // NOI18N
        l_Cedula_DPI.setName("l_Cedula_DPI"); // NOI18N

        javax.swing.GroupLayout Cedula_DPILayout = new javax.swing.GroupLayout(Cedula_DPI);
        Cedula_DPI.setLayout(Cedula_DPILayout);
        Cedula_DPILayout.setHorizontalGroup(
            Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Cedula_DPILayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(l_Cedula_DPI, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(Cedula_DPILayout.createSequentialGroup()
                        .addComponent(l_NoOrden, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31)
                        .addComponent(cb_NoOrden, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(52, 52, 52)
                        .addComponent(l_NoRegistro)
                        .addGap(111, 111, 111)
                        .addComponent(t_Registro, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(212, Short.MAX_VALUE))
        );
        Cedula_DPILayout.setVerticalGroup(
            Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Cedula_DPILayout.createSequentialGroup()
                .addComponent(l_Cedula_DPI, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(Cedula_DPILayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(l_NoOrden, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cb_NoOrden, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(l_NoRegistro)
                    .addComponent(t_Registro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(35, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel3.setName("jPanel3"); // NOI18N

        t_Correo.setName("t_Correo"); // NOI18N

        t_Cel.setName("t_Cel"); // NOI18N
        t_Cel.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_CelKeyTyped(evt);
            }
        });

        t_Casa.setName("t_Casa"); // NOI18N
        t_Casa.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                t_CasaKeyTyped(evt);
            }
        });

        rb_Casado.setText(resourceMap.getString("rb_Casado.text")); // NOI18N
        rb_Casado.setName("rb_Casado"); // NOI18N
        rb_Casado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rb_CasadoActionPerformed(evt);
            }
        });

        rb_Soltero.setText(resourceMap.getString("rb_Soltero.text")); // NOI18N
        rb_Soltero.setName("rb_Soltero"); // NOI18N
        rb_Soltero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rb_SolteroActionPerformed(evt);
            }
        });

        l_EstadoCivil1.setText(resourceMap.getString("l_EstadoCivil1.text")); // NOI18N
        l_EstadoCivil1.setName("l_EstadoCivil1"); // NOI18N

        l_Telefono.setText(resourceMap.getString("l_Telefono.text")); // NOI18N
        l_Telefono.setName("l_Telefono"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(l_EstadoCivil1, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)
                        .addComponent(l_Telefono, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jLabel7))
                .addGap(31, 31, 31)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(rb_Soltero)
                                .addGap(90, 90, 90)
                                .addComponent(rb_Casado))
                            .addComponent(t_Casa, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(52, 52, 52)
                        .addComponent(jLabel8)
                        .addGap(37, 37, 37)
                        .addComponent(t_Cel, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(t_Correo, javax.swing.GroupLayout.PREFERRED_SIZE, 388, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(173, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(l_EstadoCivil1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rb_Soltero)
                    .addComponent(rb_Casado))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(t_Casa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(l_Telefono, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(t_Cel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(t_Correo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(22, Short.MAX_VALUE))
        );

        jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(630, 630, 630)
                        .addComponent(jButton1))
                    .addComponent(Cedula_DPI, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(13, 13, 13)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(10, 10, 10)
                .addComponent(Cedula_DPI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cb_CarneItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cb_CarneItemStateChanged
        t_Nombres.setText("");
        t_Apellidos.setText("");
        t_Direccion.setText("");
        t_Zona.setText("");
        t_Casa.setText("");
        t_Cel.setText("");
        java.sql.ResultSet datos = null;
        java.sql.ResultSet direc = null;
        java.sql.ResultSet tel = null;
        try {
            datos = est.VerDatos(cb_Carne.getSelectedItem().toString());
            direc = est.ObtieneDir(cb_Carne.getSelectedItem().toString());
            tel = est.ObtenerTel(cb_Carne.getSelectedItem().toString());
            while (datos.next()) {
                l_Bufete.setText(datos.getObject("NoBufete").toString());
                t_Nombres.setText(datos.getObject("Nombre_estudiante").toString());
                t_Apellidos.setText(datos.getObject("Apellido_estudiante").toString());
                cb_NoOrden.setSelectedItem(datos.getObject("NoReg_estudiante"));
                t_Registro.setText(datos.getObject("NoOrden_estudiante").toString());
                t_Correo.setText(datos.getObject("email_estudiante").toString());
                if(datos.getObject("Estado_civil_estudiante").toString().equals("true")) {
                    rb_Casado.setSelected(false);
                    rb_Soltero.setSelected(true);
                } else {
                    rb_Soltero.setSelected(false);
                    rb_Casado.setSelected(true);
                }
            }
            while (direc.next()) {
                idDir = direc.getObject("idDireccion_estudiante").toString();
                cb_dpto.setSelectedItem(direc.getObject("Nombre_departamento"));
                cb_muni.setSelectedItem(direc.getObject("Nombre_municipio"));
                t_Direccion.setText(direc.getObject("Direccion_estudiante").toString());
                t_Zona.setText(direc.getObject("Zona").toString());
            }
            while (tel.next()) {
                if(tel.getObject("NombreTipo").toString().equals("Residencial")) {t_Casa.setText(tel.getObject("Telefono").toString()); telCasa = tel.getObject("idTelefono").toString();}
                if(tel.getObject("NombreTipo").toString().equals("Movil")) {t_Cel.setText(tel.getObject("Telefono").toString()); telCel = tel.getObject("idTelefono").toString();}
                
            }
        } catch (SQLException ex) {
            Logger.getLogger(BuscarEditarAlumno.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_cb_CarneItemStateChanged

    private void cb_dptoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cb_dptoItemStateChanged
        
        java.sql.ResultSet rs = null ;
        String idDepart = null;
        cb_muni.removeAllItems();
        try {
            rs = alumno.obtenerIdDepartamento(cb_dpto.getSelectedItem().toString());
        } catch (SQLException ex) {
            //Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            while (rs.next()){
                idDepart = rs.getObject("idDepartamento").toString();
            }
            idDpto = Integer.parseInt(idDepart);
        } catch (SQLException ex) {
            // Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        try {
            java.sql.ResultSet rss= alumno.verMunicipios(idDpto);
            while (rss.next()){
                cb_muni.addItem(rss.getObject("Nombre_municipio"));
            }
        } catch (SQLException ex) {
            //Logger.getLogger(NuevoCliente.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_cb_dptoItemStateChanged

    private void cb_dptoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_dptoActionPerformed
        //        int index = cb_dpto.getSelectedIndex();
        //        //JOptionPane.showMessageDialog(null, String.valueOf(index));
        //        while(true){
        //        try {
        //                java.sql.ResultSet rs= alumno.obtenerMunicipio(index + 1);
        //                while (rs.next()){
        //                    cb_muni.addItem(rs.getObject("Nombre_municipio"));
        //                }
        //
        //
        //            } catch (SQLException ex) {
        //                Logger.getLogger(Ingresar_alumno.class.getName()).log(Level.SEVERE, null, ex);
        //            }
        //        }
}//GEN-LAST:event_cb_dptoActionPerformed

    private void cb_muniActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_muniActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_cb_muniActionPerformed

    private void t_ZonaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_ZonaKeyTyped
        char caracter = evt.getKeyChar();
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE))|| t_Zona.getText().length() >= 2) {
            evt.consume();
        }
}//GEN-LAST:event_t_ZonaKeyTyped

    private void t_RegistroKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_RegistroKeyTyped
        char caracter = evt.getKeyChar();
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE))) {
            evt.consume();
        }
}//GEN-LAST:event_t_RegistroKeyTyped

    private void cb_NoOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cb_NoOrdenActionPerformed
        if(cb_NoOrden.isFocusable() == true) {
            //            t_NoDPI.setEnabled(false);
        }
}//GEN-LAST:event_cb_NoOrdenActionPerformed

    private void t_CelKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_CelKeyTyped
        char caracter = evt.getKeyChar();
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE))|| t_Cel.getText().length() >= 8) {
            evt.consume();
        }
}//GEN-LAST:event_t_CelKeyTyped

    private void t_CasaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_t_CasaKeyTyped
        char caracter = evt.getKeyChar();
        
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE)) || t_Casa.getText().length() >= 8) {
            evt.consume();
        }
}//GEN-LAST:event_t_CasaKeyTyped

    private void rb_CasadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rb_CasadoActionPerformed
        if(rb_Casado.isSelected() == true) {
            rb_Soltero.setSelected(false);
        }
}//GEN-LAST:event_rb_CasadoActionPerformed

    private void rb_SolteroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rb_SolteroActionPerformed
        if(rb_Soltero.isSelected() == true) {
            rb_Casado.setSelected(false);
        }
}//GEN-LAST:event_rb_SolteroActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        boolean ec = false;
        if (rb_Soltero.isSelected() == true) ec = true;
        if (rb_Casado.isSelected() == true) ec = false;
        int idMuni = 0, max = 0;
        java.sql.ResultSet rs = null;
        int dep = cb_dpto.getSelectedIndex();
        String name_muni = cb_muni.getSelectedItem().toString();
        JOptionPane.showMessageDialog(null, String.valueOf(dep) + " " + name_muni);
        try {
            rs = est.ObtenerMuni(dep + 1, name_muni);
        } catch (SQLException ex) {
            Logger.getLogger(BuscarEditarAlumno.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            while (rs.next()) {
                idMuni = Integer.parseInt(rs.getObject("idMunicipio").toString());
                JOptionPane.showMessageDialog(null, String.valueOf(idMuni));
            }
        } catch (SQLException ex) {
            Logger.getLogger(BuscarEditarAlumno.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            //String carne, String nombre, String apellido, boolean estado, String reg, int orden, String dpi, int iddir
            est.UpdtDir(idDir, t_Direccion.getText(), t_Zona.getText(), String.valueOf(idMuni));
            JOptionPane.showMessageDialog(null, "Direccion actualizada exitosamente");
            est.UpdtEst(cb_Carne.getSelectedItem().toString(), t_Nombres.getText(), t_Apellidos.getText(), ec, cb_NoOrden.getSelectedItem().toString(), Integer.valueOf(t_Registro.getText()), null, idDir, t_Correo.getText()," ");
            JOptionPane.showMessageDialog(null, "Estudiante actualizada exitosamente");
            est.UpdTel(telCasa, t_Casa.getText(), cb_Carne.getSelectedItem().toString(), String.valueOf(1));
            est.UpdTel(telCel, t_Cel.getText(), cb_Carne.getSelectedItem().toString(), String.valueOf(2));
        } catch (SQLException ex) {
            Logger.getLogger(BuscarEditarAlumno.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new BusquedaAlumno().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Cedula_DPI;
    private javax.swing.JComboBox cb_Carne;
    private javax.swing.JComboBox cb_NoOrden;
    private javax.swing.JComboBox cb_dpto;
    private javax.swing.JComboBox cb_muni;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JLabel l_Bufete;
    private javax.swing.JLabel l_Cedula_DPI;
    private javax.swing.JLabel l_EstadoCivil1;
    private javax.swing.JLabel l_NoOrden;
    private javax.swing.JLabel l_NoRegistro;
    private javax.swing.JLabel l_Telefono;
    private javax.swing.JRadioButton rb_Casado;
    private javax.swing.JRadioButton rb_Soltero;
    private javax.swing.JTextField t_Apellidos;
    private javax.swing.JTextField t_Casa;
    private javax.swing.JTextField t_Cel;
    private javax.swing.JTextField t_Correo;
    private javax.swing.JTextField t_Direccion;
    private javax.swing.JTextField t_Nombres;
    private javax.swing.JTextField t_Registro;
    private javax.swing.JTextField t_Zona;
    // End of variables declaration//GEN-END:variables
}
